//
//  BSVideoView.m
//  BaiSi
//
//  Created by Sycamore on 16/5/4.
//  Copyright © 2016年 Sycamore. All rights reserved.
//

#import "BSVideoView.h"
#import "BSThemeItem.h"
#import <UIImageView+WebCache.h>

@interface BSVideoView ()

@property (weak, nonatomic) IBOutlet UILabel *timesLabel;

@property (weak, nonatomic) IBOutlet UILabel *totleTimeLabel;
@property (weak, nonatomic) IBOutlet UIImageView *imageView;

@end

@implementation BSVideoView


- (void)setItem:(BSThemeItem *)item
{
    [super setItem:item];
    
    [_imageView sd_setImageWithURL:[NSURL URLWithString:item.image0]];
    
    NSInteger playcount = [item.playcount integerValue];
    if (playcount > 10000) {
        _timesLabel.text = [NSString stringWithFormat:@"%.1fw播放",playcount / 10000.0];
        _timesLabel.text = [_timesLabel.text stringByReplacingOccurrencesOfString:@".0" withString:@""];
    }
    else{
        _timesLabel.text = [NSString stringWithFormat:@"%@播放",item.playcount];
    }
    
    NSInteger minute = [item.videotime integerValue] / 60 ;
    NSInteger second = [item.videotime integerValue] % 60 ;
    _totleTimeLabel.text = [NSString stringWithFormat:@"%02ld:%02ld",minute,second];
}

@end
